package com.kylin.user.api.web.facade;

import com.kylin.shared.common.ResponseWrapper;
import com.kylin.user.api.dto.req.CreateUserAddressReqDTO;
import com.kylin.user.api.dto.req.QueryUserAddressReqDTO;
import com.kylin.user.api.dto.req.UpdateAddressReqDTO;
import com.kylin.user.api.dto.resp.UserAddressRespDTO;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户地址接口定义
 * @author Damon S.
 * @version v1.0.1
 * @date 2020年05月20日 19:34
 */
@RequestMapping(value = "/api_v1/users", produces = MediaType.APPLICATION_JSON_VALUE)
public interface UserPlatformFacade {

    @GetMapping("/address")
    ResponseWrapper<List<UserAddressRespDTO>> listUserAddress(
            @RequestBody @Validated QueryUserAddressReqDTO req
    );


    @GetMapping("/address/default")
    ResponseWrapper<UserAddressRespDTO> findDefaultAddress();


    @DeleteMapping("/address/{addressId}")
    ResponseWrapper<Boolean> removeByAddressId(@PathVariable Long addressId);


    @PutMapping("/address")
    ResponseWrapper<UserAddressRespDTO> updateUserAddress(
            @RequestBody @Validated UpdateAddressReqDTO req
    );


    @PostMapping("/address")
    ResponseWrapper<Boolean> addUserAddress(
            @RequestBody @Validated CreateUserAddressReqDTO req
    );
}
